﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="MyInvoices.aspx.cs" Inherits="MyInvoices" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <asp:Panel ID="AuthenticatedHeaderPanel" runat="server">
        <ul id="user">
            <li>
                <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutPageUrl="~/Login.aspx" />
            </li>
        </ul>

        <div id="header-inner">
            <div class="textt">
            <h4>
                <asp:Label runat="server" ID="WelcomeBackMessage"></asp:Label>
                <asp:label id="lblMessage" runat="server" enableviewstate="false" />
            </h4>
            </div>
        </div>
    </asp:Panel>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Menu" Runat="Server">
<div id="left">
<div id = "navigation">
    <asp:Panel runat="server" ID="AuthenticatedMenuPanel" Width="200px">
        <div id="menu-header">
            <div class="menutext">
                <asp:Label ID="Label1" runat="server" Text="Menu"/>
            </div> 
        </div>
          <asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="3" BackColor="White" DynamicHoverStyle-BorderStyle="NotSet" Width="200px">
              <Items>
                
                <asp:MenuItem Text="Home" Value="Home" navigateurl="Default.aspx">
                  <asp:MenuItem Text="New Document" Value="New Document" navigateurl="AddDocument.aspx">                   
                   </asp:MenuItem>
                </asp:MenuItem>

                <asp:MenuItem Text="Users" Value="My_Users" navigateurl="MyUsers.aspx">
                  <asp:MenuItem Text="New User" Value="New_User" navigateurl="AddUser.aspx">
                   </asp:MenuItem>
                </asp:MenuItem>
               
                <asp:MenuItem Text="Companies" Value="Companies" navigateurl="MyCompanies.aspx">
                  <asp:MenuItem Text="New Company" Value="New_Company" navigateurl="AddCompany.aspx">
                   </asp:MenuItem>
                </asp:MenuItem>
                
                <asp:MenuItem Text="Clients" Value="Clients" navigateurl="MyClients.aspx">
                  <asp:MenuItem Text="New Client" Value="New_Client" navigateurl="AddClient.aspx">
                   </asp:MenuItem>
                </asp:MenuItem>

              </Items>
          </asp:Menu>
     </asp:Panel>
</div>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" Runat="Server"> 
   <div id= "right"> 
    <asp:Panel runat="server" ID="AuthenticatedMessagePanel">
        <div class="box">
            <div class ="title">
                <h6>
                    <asp:Label ID="Label2" runat="server" Text="Your documents"></asp:Label>
                </h6>
            </div>
             <script type = "text/javascript">
                 function Confirm() {
                     var confirm_value = document.createElement("INPUT");
                     confirm_value.type = "hidden";
                     confirm_value.name = "confirm_value";
                     if (confirm("Vai vēlaties dzēst dokumentu?")) {
                         confirm_value.value = "Jā";
                     } else {
                         confirm_value.value = "Atcelt";
                     }
                     document.forms[0].appendChild(confirm_value);
                 }
              </script>
        <div class="lists">
           <asp:ListView ID="ListView1" runat="server" onsorting="ListView1_Sorting" onitemcommand="ListView1_ItemCommand" onitemdatabound="ListView1_ItemDataBound">
             <LayoutTemplate>
                <table id="gradient-style" class="tab">
                      <thead>
                          <tr>
                            <th></th>
                            <th> Document number</th>
                            <th> Date</th>
                            <th> Payment date</th>
                            <th> User</th>
                            <th> Company from</th>
                            <th> Company to</th>
                            <th> Document type</th>
                            <th> Payment type</th>
                            <th colspan="3"> Options</th>
                          </tr>
                       </thead>                          
                      <tr ID="itemPlaceholder" runat="server"></tr>                       
                       <tfoot>
                        <tr>
                            <th style="text-align:right" colspan="14">
                            <asp:DataPager ID="DataPager" runat="server">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
                                </Fields>
                            </asp:DataPager>
                            </th>
                        </tr>
                       </tfoot>
                </table>
            </LayoutTemplate>
            <AlternatingItemTemplate>
                <tr>
                    <td id="docID" runat="server">
                        <asp:Label ID="doc_IDLabel" runat="server" Text='<%# Eval("id") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="check_delete_doc" runat="server"/>
                    </td>
                    <td>
                        <asp:LinkButton ID="document_numberLabel" runat="server" Text='<%# Eval("document_number") %>' CommandName="Invoice"/>
                    </td>
                    <td id="doc_num" runat="server">
                        <asp:Label ID="document_numLabel" runat="server" Text='<%# Eval("document_number") %>' />
                    </td>
                    <td>
                        <asp:Label ID="document_dateLabel" runat="server" Text='<%# Eval("document_date","{0:yyyy.MM.dd}") %>' />
                    </td>
                    <td>
                        <asp:Label ID="document_payment_dateLabel" runat="server" Text='<%# Eval("document_payment_date","{0:yyyy.MM.dd}") %>' />
                    </td>
                    <td>
                        <asp:Label ID="issued_by_userLabel" runat="server" Text='<%# Eval("issued_by_user") %>' />
                    </td>
                    <td>
                        <asp:Label ID="company_issued_byLabel" runat="server" Text='<%# Eval("company_issued_by") %>' />
                    </td>
                    <td>
                        <asp:Label ID="company_issued_toLabel" runat="server" Text='<%# Eval("client_issued_to") %>' />
                    </td>
                    <td>
                        <asp:Label ID="id_document_typeLabel" runat="server" Text='<%# Eval("document_type") %>' />
                    </td>
                    <td>
                        <asp:Label ID="id_payment_typeLabel" runat="server" Text='<%# Eval("payment_type") %>' />
                    </td>
                    <td id="idL" runat="server">
                        <asp:Label ID="id_issued_userLabel" runat="server" Text='<%# Eval("id_issued_by_user") %>' />
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" OnClick = "OnConfirm" OnClientClick = "Confirm()">Delete</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkShare" runat="server" CommandName="Share">Share</asp:LinkButton>
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <ItemTemplate>
                <tr>
                    <td id="docID" runat="server">
                        <asp:Label ID="doc_IDLabel" runat="server" Text='<%# Eval("id") %>' />
                    </td>
                    <td>
                        <asp:CheckBox ID="check_delete_doc" runat="server"/>
                    </td>
                    <td>
                        <asp:LinkButton ID="document_numberLabel" runat="server" Text='<%# Eval("document_number") %>' CommandName="Invoice"/>
                    </td>
                    <td id="doc_num" runat="server">
                        <asp:Label ID="document_numLabel" runat="server" Text='<%# Eval("document_number") %>' />
                    </td>
                    <td>
                        <asp:Label ID="document_dateLabel" runat="server" Text='<%# Eval("document_date","{0:yyyy.MM.dd}") %>' />
                    </td>
                    <td>
                        <asp:Label ID="document_payment_dateLabel" runat="server" Text='<%# Eval("document_payment_date","{0:yyyy.MM.dd}") %>' />
                    </td>
                    <td>
                        <asp:Label ID="issued_by_userLabel" runat="server" Text='<%# Eval("issued_by_user") %>' />
                    </td>
                    <td>
                        <asp:Label ID="company_issued_byLabel" runat="server" Text='<%# Eval("company_issued_by") %>' />
                    </td>
                    <td>
                        <asp:Label ID="company_issued_toLabel" runat="server" Text='<%# Eval("client_issued_to") %>' />
                    </td>
                    <td>
                        <asp:Label ID="id_document_typeLabel" runat="server" Text='<%# Eval("document_type") %>' />
                    </td>
                    <td>
                        <asp:Label ID="id_payment_typeLabel" runat="server" Text='<%# Eval("payment_type") %>' />
                    </td>
                    <td id="idL" runat="server">
                        <asp:Label ID="id_issued_userLabel" runat="server" Text='<%# Eval("id_issued_by_user") %>' />
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                    </td>
                    <td runat="server">
                        <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" OnClick = "OnConfirm" OnClientClick = "Confirm()">Delete</asp:LinkButton>
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkShare" runat="server" CommandName="Share">Share</asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
        
        <div class="button">
            <ul id="confirm">
               <li>
                   <asp:LinkButton ID="bt_delete_all_my_invoices" runat="server" Text="Delete selected documents" onclick="bt_delete_all_my_invoices_Click"/>
               </li>
            </ul>
        </div> 
        <div class="message-notice" id="message" runat="server">
            <div class="image">
                <img height="32" alt="Notice" src="Images/notice.png">
            </div>
            <div class="text">
                <h4>You have no documents!</h4>
            </div>
        </div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"/>
    </div>
    </div>
    </asp:Panel>
</div>
</asp:Content>



